We started to version them last cycle, so docs can be differentiated
between versions. It is not *expected* that two versions show up
on the same system, but then it also doesn't hurt handling it.
animationUtils: Group together various animation helpers
The environment module is used to initialize the environment, yet it
currently also defines the adjustAnimationTime() function.
Ideally it should not export any utility functions, in particular
once converted to ESM.
The function cannot be moved to the existing Utils module, as that
depends on an initialized environment, and can therefore not be
imported from environment.js, so use that opportunity to group
together several animation helpers in a new animationUtils module.
Part of the possible completions involves evaluating the part
of the passed in text that looks like an object, so that we
can query it for properties.
Using a Function or eval() for that means that we can only
complete text that does not use `await`. To get over that
limitation, evaluate the text in an AsyncFunction instead.
We currently throw an error when encountering a result that cannot
be represented as string, with the prompt appearing somewhat stuck
(the input cannot be committed).
Showing a lame fallback instead at least avoids that issue. When
the object has a typeof 'object' but is not an instanceof Object,
we are likely dealing with an ES module, and can show a slightly
less lame fallback.
We currently include a fake config.js file to satisfy the indirect
import from ExtensionUtils. However we're about to need to pass
build-time information into the program ourselves, so generate
a proper file.
st/icon-theme: Remove special-casing of symbolic lookup
GThemedIcon considers the "-symbolic" suffix when generating
fallback names (i.e. "foo-bar-symbolic", "foo-symbolic", "foo-bar",
"foo").
That means now that we prefer more accurate name matches from any
theme over fallback matches from higher-priority themes, we no
longer need to special-case symbolic names for preferring symbolic
matches over full-color fallbacks.
st/icon-theme: Pick best-matching name from all themes
When resolving an icon name, we currently look in all themes in
order whether one of the requested names matches.
That means, a "keyboard" icon from the configured theme will
trump over any of "keyboard-shift", "keyboard-brightness" and
"keyboard-preferences" from lower-ranked themes (like "Adwaita"
and "hicolor").
That applies to custom icons we include in the resource, which
are added to the fallback ("hicolor") theme.
We are less bound by the named-icons spec than GTK, so we can
adapt the lookup to prefer the most accurate match to matches
from the highest priority theme.
Florian Müllner [Mon, 1 Aug 2022 09:26:59 +0000 (11:26 +0200)]
main: Replace custom log function with console
console.log() is implemented with structured logging, and as we
set an appropriate log domain, it's identical to the custom function
bar the custom fields with extension data.
Few people know about those custom fields, and adding them comes
at a cost, as we end up producing and parsing a stacktrace on
every log() call.
It therefore seems appropriate to drop the custom function, and
turn the global log() symbol into a simple convenience alias for
console.log().
If it turns out that people do miss the custom fields, we can add
an alternative to ExtensionUtils.
Florian Müllner [Mon, 1 Aug 2022 09:22:06 +0000 (11:22 +0200)]
main: Remove log compatibility
global.log() hasn't been used since 3.6. It seems extremely unlikely
that any extensions are still using it, not least because `log()` is
more convenient.
Florian Müllner [Tue, 27 Jun 2023 18:27:53 +0000 (20:27 +0200)]
tests: Stop bundling "perf" tests with gnome-shell
Now that scripts are loaded as external modules, there's no reason
anymore for bundling them with the gnome-shell executable. Just
move the scripts into a dedicated folder in tests/ and run them
from there.
The purpose of the tool has shifted from running a limited set
of performance tests repeatedly to collect performance data
and catch regressions, to a wrapper that drives gnome-shell via
scripts for tests.
With that, the concept of a "default" script doesn't really make
sense anymore.
Instead, turn the argument from an optional flag into a required
parameter. This will allow us to stop bundling the existing tests
in a follow-up commit.
Florian Müllner [Tue, 27 Jun 2023 18:22:28 +0000 (20:22 +0200)]
test-tool: Rename perf-tool
The original purpose of the tool was to collect performance data
that would optionally be uploaded to a server in Owen's living
room. While the corresponding scripts are still included (although
the server was probably dismantled years ago), the tool is mainly
used for running gnome-shell with scripted tests nowadays.
Florian Müllner [Tue, 13 Jun 2023 01:53:32 +0000 (03:53 +0200)]
main: Pass script on CLI instead of via environment
Environment variables aren't the best option to pass parameters
to a process (wouldn't it be "fun" if SHELL_PERF_MODULE appeared
in a regular user session?).
Instead, use a (hidden) --automation-script command line flag to
specify a script file that should be used to drive an automated
session.
As a side effect, the script no longer has to be relative to the
main module itself, so it will be possible to run scripts that
aren't bundled with the shell sources.
Florian Müllner [Tue, 13 Jun 2023 00:13:01 +0000 (02:13 +0200)]
main: Load perf scripts as modules
The perf scripts that can be used to script the gnome-shell UI
for testing are sufficiently separate from the rest of the code
base to allow porting them to ESM modules before the rest of
the code base.
Florian Müllner [Mon, 12 Jun 2023 21:28:54 +0000 (23:28 +0200)]
extensionSystem: Remove "disable" file on shutdown
The file indicates to the systemd shutdown scripts that extensions
should be disabled, so that extensions that crash the shell on
startup cannot lock out the user indefinitely.
For that purpose, we create the file before initializing extensions,
and remove it after 60 seconds. That generally works, because it's
highly unlikely that a session genuinely ends within the first minute.
It's possible though (for example during developments or when running
tests), so also remove the file when shutting down cleanly before
the timeout.
Florian Müllner [Thu, 1 Jun 2023 22:47:22 +0000 (00:47 +0200)]
extensionSystem: Load extensions as modules
Continue the move to ESM by loading modules dynamically with
the standard import() expression, rather than by installing a
custom (legacy) importer.
This is a breaking change that affects all extensions, as they
now need to explicitly export the expected symbols.
As we are already breaking all extensions, take that opportunity
and remove support for the individual entry points: Using a
class with enable()/disable() methods has been the recommended
pattern for a long time, it is now the only entry point.
Instead of instantiating the class from an `init()` function,
the class must now be exported as default to be recognized.
Additionally, we no longer install an importer on the extension
object, so extensions that consist of more than one file MUST
import those files as modules now.
There will be a second breaking change for extensions when
gnome-shell's own code is ported to ESM, so most extension
developers will likely want to wait until the port is complete
before starting to port their extensions.
Florian Müllner [Fri, 9 Jun 2023 18:12:15 +0000 (20:12 +0200)]
animations: Stop syncing size manually
The returned slice actors are now set up to fill their parent,
accounting for any difference between loaded- and displayed size,
so we can stop syncing the size manually.
Florian Müllner [Fri, 9 Jun 2023 17:52:15 +0000 (19:52 +0200)]
st/texture-cache: Set up sliced images to fill parent
When using fractional scaling, the size of the loaded image with
applied scaling may still differ from the displayed size. This
is currently addressed by syncing the size of all slice actors
in the (probably only) caller.
Instead, set the actors to fill their parent automatically.
If langinfo isn't available, we determine the week start via
a "magic" string translation from GTK. We currently look up
the string in GTK3's domain, we should use GTK4's instead.
Florian Müllner [Thu, 22 Jun 2023 16:10:48 +0000 (18:10 +0200)]
tests: Remove interactive tests
The tests rely on the ability to run Clutter as stand-alone app,
which hasn't been possible for quite a while now. Event handling
was broken long before that, plus tests that need a human to run
them and evaluate the result aren't that useful to begin with.
It would be neat to test our CSS rendering by setting up a stage,
capturing it and comparing it to a reference image. But writing
some code that exercises backgrounds, borders etc. is hardly the
obstacle to make that happen, and not worth carrying around dead
code.
Florian Müllner [Wed, 28 Jun 2023 21:36:29 +0000 (23:36 +0200)]
ci: Bump mutter image
Mutter stopped hardcoding a non-default user in the image, and
instead wraps its CI tests to run as user. Pull in that image
to hopefully get over some of the recent CI hickups.
Florian Müllner [Tue, 21 Mar 2023 16:07:19 +0000 (17:07 +0100)]
windowManager: Add shortcut for toggling quick settings
Ever since the various status menus were combined into a single
aggregate menu, the menu has been an important entry point. Alas,
we never got around to adding a shortcut for it, not least because
there never was a good candidate.
We just freed super+s which works as either "system" or
"(quick) settings", so use that.
Florian Müllner [Tue, 21 Mar 2023 17:09:08 +0000 (18:09 +0100)]
windowManager: Reindent shortcuts setup
We require all new code to use the non-legacy style. Updating code
on a case-by-case basis works fairly well most of the time, but
here we have a big uniform block, where any addition with a different
style would stick out badly.
data: Unset default shortcut for 'toggle-overview'
The keybinding is a direct, less commonly used alternative to
stand-alone 'super'. While it can be useful to have a regular
keybinding alternative - although 'super+alt+up' also provides
that to some extent - most users probably don't even know about
it's existence.
It is therefore less justified to take away a valuable shortcut
slot, so stop assigning a default shortcut to free 'super+s' for
other actions.
Users who do use the keybinding can still use Settings to assign
a shortcut.
Florian Müllner [Tue, 30 May 2023 12:41:36 +0000 (14:41 +0200)]
portalHelper: Stop using non-default ARGV vector
If gjs itself defines ARGV, it only holds the arguments that are
passed on to the script, and javascript code should combine the
programName and ARGV (or the newer programArgs) when it needs a
C-style argv array.
Do the same in the portal-helper process instead of passing along
the original C argv, to avoid confusion when accessing the arguments
from javascript.
Florian Müllner [Thu, 25 May 2023 19:23:24 +0000 (21:23 +0200)]
extensions-app: Port to ESM
The extensions app is another part of the code base that is largely
separate from the main code base, and can therefore be ported to
ESM before the big switch.
Florian Müllner [Thu, 25 May 2023 18:31:22 +0000 (20:31 +0200)]
dbusServices: Port to ESM
We want to replace gjs' custom (and now legacy) imports system
with standard EcmaScript modules: JS developers are already
familiar with them, they have better tooling support and using
standard features over non-standard ones is generally the right
thing to do.
Our D-Bus services are separate from the main process, and thus
can be ported separately (except for the few imports that are
shared with the main process' code base).
Sam Hewitt [Mon, 19 Jun 2023 19:52:29 +0000 (17:22 -0230)]
panel: Stylesheet updates and minor improvements for panel buttons
- spin out all the panel button styling into a drawing mixin
- clean up the styles generally
- make special cases for the clock and non-flat buttons
- contrast fixes for non-flat buttons, fixes #6768
- new stop icon for the screen recording/cast indicators
Florian Müllner [Mon, 19 Jun 2023 00:24:47 +0000 (02:24 +0200)]
workspace: Reapply border radius on background changes
The rounded corner effect is applied to the background actor, so
we have to reapply the correct values when the background changes
for the corners to persist.
Florian Müllner [Sat, 27 May 2023 13:00:43 +0000 (15:00 +0200)]
subprojects/shew: Adjust to GTK deprecation
GTK 4.12 deprecates gdk_wayland_toplevel_unexport_handle() in favor
of the new gdk_wayland_toplevel_drop_exported_handle(). We are not
bound by API stability, so we can just expose the additional argument
that the replacement requires instead of tracking the handle
internally.
Florian Müllner [Fri, 9 Jun 2023 13:41:03 +0000 (15:41 +0200)]
parentalControlsManager: Don't log error when disabled
We currently special-case the DISABLED error when initializing
filtering, but not on app filter changes.
While it seems reasonable that Malcontent.Manager wouldn't emit
the signal while disabled, that's not actually true: It is emitted
when any user account information tracked by AccountsServices
changes.
Even if the signal were limited to changes of the ParentalControls
extension, it would still get emitted when app filtering *becomes*
disabled.
So regardless of potential improvements in libmalcontent itself,
we should filter out the DISABLED consistently, both when creating
the initial filter and when updating it.
Андрей Гриценко [Mon, 29 May 2023 14:42:13 +0000 (17:42 +0300)]
magnifier: Fix cursor offset
Commit c449058d447c2588d changed the pointer clone to use a single
actor. However that broke applying the hotspot translation to the
position, so the magnified cursor is now displayed with a shift.
Evan Welsh [Wed, 7 Jun 2023 15:58:08 +0000 (08:58 -0700)]
init: Move Meta main loop into JavaScript after GJS context is initialized
gjs now has an internal mainloop that it can spin to resolve
module imports. That loop uses the thread default context,
so its possible that other sources, namely from mutter, get
dispatched when iterating the context. If that happens before
mutter is properly initialized, this will lead to a crash.
GjsContext needs to iterate its internal mainloop when initializing
to resolve internal modules, to avoid iterating Meta's mainloop and
triggering events before Meta is ready we will initialize the Shell
global and thus the GjsContext (js_context) before Meta.
Once GjsContext is initialized, we can call meta_context_setup().
Once Meta is setup and started, we'll run init.js which uses GJS'
internal promises API to set a "mainloop hook". The mainloop hook
is run immediately after the module returns so GJS will not attempt
to iterate the main loop again before exiting.
Also adjust the 'headlessStart' test to not wait for the
MetaContext::started signal, as that signal has now already
been emitted when the code is executed.
Evan Welsh [Wed, 7 Jun 2023 15:30:29 +0000 (08:30 -0700)]
panel: Refactor quick settings loading for asynchronous imports
When the Shell ports to ESM, our inline imports of the network and
bluetooth indicators will no longer be possible, refactor quick settings
to load indicators asynchronously.
Evan Welsh [Wed, 7 Jun 2023 15:47:50 +0000 (08:47 -0700)]
animation: Don't get size information until spinner has a parent
get_size() in _syncAnimationSize() can't be called until the actor
has a parent, otherwise we'll get an error for calling
st_get_theme_node() prior to the actor being on a stage.
_syncAnimationSize() is called asynchronously via
textureCache.load_sliced_image() and there is currently no guarantee
the actor will actually be "loaded" prior to calling it.
This becomes a more obvious error/issue when refactoring parts of the
Shell loading to also be asynchronous.
The windows we create use a simple pattern as content, as that's
easier to follow than completely empty windows. GTK4 no longer
allows hooking into the drawing of arbitrary widgets, so prepare
for that by using a dedicated subclass instead of a signal handler.
GTK4 no longer has the concept of "app-paintable" to skip the
default background drawing. Prepare for that by setting the
desired background via CSS and draw on top of that.
The signals we use to track whether a window has been mapped and
exposed no longer exist in GTK4. Prepare for that by using a
dedicated subclass instead of signal handlers.
The gtk_main() API is gone in GTK4, so we'll have to either
manage our own loop, or use GApplication. The latter also
handles the D-Bus setup for us, so use that.
Florian Müllner [Sat, 27 May 2023 01:19:39 +0000 (03:19 +0200)]
scripting: Make helper proxy initialization async
We are about to port the helper proxy to GApplication, which means
that it will establish a display connection before exporting its
D-Bus name. That means that the compositor must be able to respond
to a roundtrip request to avoid locking, so don't block on the proxy
becoming available.
Florian Müllner [Wed, 8 Mar 2023 19:25:13 +0000 (20:25 +0100)]
tests: Port to Gtk4
There's another remaining bit of Gtk3 code in a small test program
that changes a window title to a random character sequence every
five seconds. While the value of that test is a bit questionable,
it doesn't hurt either and a port is trivial.
Its only purpose is to provide a test case for the remote app menu,
but that support was removed in gnome-shell years ago. We don't
need a test case for GTK's fallback app menu support, so remove
the whole thing.
Florian Müllner [Fri, 19 May 2023 17:02:08 +0000 (19:02 +0200)]
backgroundApps: Allow activating apps
Now that we track apps instead of instances, we can make the menu
items activatable, because the corresponding action is no longer
app specific (like activating a particular tab): We can simply
activate the app, which hopefully will bring it to the foreground
again.
Florian Müllner [Fri, 19 May 2023 14:36:39 +0000 (16:36 +0200)]
backgroundApps: Track apps instead of instances
The background apps menu currently tracks instances rather than
apps. That matches the behavior of `flatpak ps` and can be useful,
for example when one particular instance runs out of control.
But as we don't include any information that allows to actually
distinguish between instances, multiple instances appear simply
as duplicated app entries.
Given that a menu is too limited for detailed information, stop
representing individual instances, and track apps instead.
Andy Holmes [Thu, 1 Jun 2023 22:54:59 +0000 (15:54 -0700)]
overview: Provide public access for search provider registration
Provide a reasonably public way to register and unregister search
providers, without adding too much API.
`Main.overview.searchController` provides access that may be generally
useful, while `SearchController.addProvider()` and
`SearchController.removeProvider()` provide a simple interface for
extensions.
When introducing the pipeline fallback mechanism, support for defining a
custom pipeline was unintentionally dropped, breaking extensions such as
EasyScreenCast.